import inputNumber from '@/common/directives/input-number'
import bindDirective from '@/common/directives/bind-directive'
import permission from '@/common/directives/permission'
import selectLoadmore from '@/common/directives/select-loadmore'
import dialogDrag from '@/common/directives/dialog-drag'

export const directives = {
  'input-number': inputNumber,
  permission: permission,
  'select-loadmore': selectLoadmore,
  'dialog-drag': dialogDrag,
}

const install = Vue => {
  if (install.installed) return
  install.installed = true

  Vue.directive('bind-directive', bindDirective)
  Object.keys(directives).forEach(key => {
    Vue.directive(key, directives[key])
  })
}

export default install
